//
// See the file COPYING for redistribution information.
//

#include <iostream>
#include <Naipax.hpp>

using namespace std;
using namespace Naipax;

void OnAccept(int32_t Fd, void *pArg) {
    if (pArg == NULL) {
        return;
    }
    
    char *pData = (char*) pArg;
    cout << "CLIENT FD: " << Fd << endl;
    cout << "DATA: " << pData << endl;
}

int main() {
    cerr << "Test for the ServiceServer module" << endl;

    try {
        char Data[] = "This is the callback data";
        ServiceServer Ss;

        Ss.Setup(1234);
        Ss.mOnAccept = OnAccept;
        Ss.Process(Data);
    }
    catch (Naipax::Error &E) {
        NAIPAX_PERROR(E.What());
        return -1;
    }

    return 0;
}
